﻿// --------------------------------------------------------------------------------------------
// <copyright file="BasicFixture.cs" company="Effort Team">
//     Copyright (C) 2011-2014 Effort Team
//
//     Permission is hereby granted, free of charge, to any person obtaining a copy
//     of this software and associated documentation files (the "Software"), to deal
//     in the Software without restriction, including without limitation the rights
//     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//     copies of the Software, and to permit persons to whom the Software is
//     furnished to do so, subject to the following conditions:
//
//     The above copyright notice and this permission notice shall be included in
//     all copies or substantial portions of the Software.
//
//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//     THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------

namespace Effort.Test.Features
{
    using System.Collections.Generic;
    using System.Linq;
    using Effort.Test.Data.Northwind;
    using Effort.Test.Internal.Queries;
    using NUnit.Framework;

    [TestFixture]
    public class BasicFixture
    {
        private IQueryTester<NorthwindObjectContext> tester;

        [SetUp]
        public void Initialize()
        {
            this.tester = new NorthwindQueryTester();
        }

        [Test]
        public void FullTableScan()
        {
            string expected = "[{\"ProductID\":1,\"ProductName\":\"Chai\",\"SupplierID\":1,\"CategoryID\":1,\"QuantityPerUnit\":\"10 boxes x 20 bags\",\"UnitPrice\":18.0,\"UnitsInStock\":39,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":2,\"ProductName\":\"Chang\",\"SupplierID\":1,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 12 oz bottles\",\"UnitPrice\":19.0,\"UnitsInStock\":17,\"UnitsOnOrder\":40,\"ReorderLevel\":25},{\"ProductID\":3,\"ProductName\":\"Aniseed Syrup\",\"SupplierID\":1,\"CategoryID\":2,\"QuantityPerUnit\":\"12 - 550 ml bottles\",\"UnitPrice\":10.0,\"UnitsInStock\":13,\"UnitsOnOrder\":70,\"ReorderLevel\":25},{\"ProductID\":4,\"ProductName\":\"Chef Anton's Cajun Seasoning\",\"SupplierID\":2,\"CategoryID\":2,\"QuantityPerUnit\":\"48 - 6 oz jars\",\"UnitPrice\":22.0,\"UnitsInStock\":53,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":5,\"ProductName\":\"Chef Anton's Gumbo Mix\",\"SupplierID\":2,\"CategoryID\":2,\"QuantityPerUnit\":\"36 boxes\",\"UnitPrice\":21.35,\"UnitsInStock\":0,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":6,\"ProductName\":\"Grandma's Boysenberry Spread\",\"SupplierID\":3,\"CategoryID\":2,\"QuantityPerUnit\":\"12 - 8 oz jars\",\"UnitPrice\":25.0,\"UnitsInStock\":120,\"UnitsOnOrder\":0,\"ReorderLevel\":25},{\"ProductID\":7,\"ProductName\":\"Uncle Bob's Organic Dried Pears\",\"SupplierID\":3,\"CategoryID\":7,\"QuantityPerUnit\":\"12 - 1 lb pkgs.\",\"UnitPrice\":30.0,\"UnitsInStock\":15,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":8,\"ProductName\":\"Northwoods Cranberry Sauce\",\"SupplierID\":3,\"CategoryID\":2,\"QuantityPerUnit\":\"12 - 12 oz jars\",\"UnitPrice\":40.0,\"UnitsInStock\":6,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":9,\"ProductName\":\"Mishi Kobe Niku\",\"SupplierID\":4,\"CategoryID\":6,\"QuantityPerUnit\":\"18 - 500 g pkgs.\",\"UnitPrice\":97.0,\"UnitsInStock\":29,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":10,\"ProductName\":\"Ikura\",\"SupplierID\":4,\"CategoryID\":8,\"QuantityPerUnit\":\"12 - 200 ml jars\",\"UnitPrice\":31.0,\"UnitsInStock\":31,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":11,\"ProductName\":\"Queso Cabrales\",\"SupplierID\":5,\"CategoryID\":4,\"QuantityPerUnit\":\"1 kg pkg.\",\"UnitPrice\":21.0,\"UnitsInStock\":22,\"UnitsOnOrder\":30,\"ReorderLevel\":30},{\"ProductID\":12,\"ProductName\":\"Queso Manchego La Pastora\",\"SupplierID\":5,\"CategoryID\":4,\"QuantityPerUnit\":\"10 - 500 g pkgs.\",\"UnitPrice\":38.0,\"UnitsInStock\":86,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":13,\"ProductName\":\"Konbu\",\"SupplierID\":6,\"CategoryID\":8,\"QuantityPerUnit\":\"2 kg box\",\"UnitPrice\":6.0,\"UnitsInStock\":24,\"UnitsOnOrder\":0,\"ReorderLevel\":5},{\"ProductID\":14,\"ProductName\":\"Tofu\",\"SupplierID\":6,\"CategoryID\":7,\"QuantityPerUnit\":\"40 - 100 g pkgs.\",\"UnitPrice\":23.25,\"UnitsInStock\":35,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":15,\"ProductName\":\"Genen Shouyu\",\"SupplierID\":6,\"CategoryID\":2,\"QuantityPerUnit\":\"24 - 250 ml bottles\",\"UnitPrice\":15.5,\"UnitsInStock\":39,\"UnitsOnOrder\":0,\"ReorderLevel\":5},{\"ProductID\":16,\"ProductName\":\"Pavlova\",\"SupplierID\":7,\"CategoryID\":3,\"QuantityPerUnit\":\"32 - 500 g boxes\",\"UnitPrice\":17.45,\"UnitsInStock\":29,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":17,\"ProductName\":\"Alice Mutton\",\"SupplierID\":7,\"CategoryID\":6,\"QuantityPerUnit\":\"20 - 1 kg tins\",\"UnitPrice\":39.0,\"UnitsInStock\":0,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":18,\"ProductName\":\"Carnarvon Tigers\",\"SupplierID\":7,\"CategoryID\":8,\"QuantityPerUnit\":\"16 kg pkg.\",\"UnitPrice\":62.5,\"UnitsInStock\":42,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":19,\"ProductName\":\"Teatime Chocolate Biscuits\",\"SupplierID\":8,\"CategoryID\":3,\"QuantityPerUnit\":\"10 boxes x 12 pieces\",\"UnitPrice\":9.2,\"UnitsInStock\":25,\"UnitsOnOrder\":0,\"ReorderLevel\":5},{\"ProductID\":20,\"ProductName\":\"Sir Rodney's Marmalade\",\"SupplierID\":8,\"CategoryID\":3,\"QuantityPerUnit\":\"30 gift boxes\",\"UnitPrice\":81.0,\"UnitsInStock\":40,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":21,\"ProductName\":\"Sir Rodney's Scones\",\"SupplierID\":8,\"CategoryID\":3,\"QuantityPerUnit\":\"24 pkgs. x 4 pieces\",\"UnitPrice\":10.0,\"UnitsInStock\":3,\"UnitsOnOrder\":40,\"ReorderLevel\":5},{\"ProductID\":22,\"ProductName\":\"Gustaf's Knäckebröd\",\"SupplierID\":9,\"CategoryID\":5,\"QuantityPerUnit\":\"24 - 500 g pkgs.\",\"UnitPrice\":21.0,\"UnitsInStock\":104,\"UnitsOnOrder\":0,\"ReorderLevel\":25},{\"ProductID\":23,\"ProductName\":\"Tunnbröd\",\"SupplierID\":9,\"CategoryID\":5,\"QuantityPerUnit\":\"12 - 250 g pkgs.\",\"UnitPrice\":9.0,\"UnitsInStock\":61,\"UnitsOnOrder\":0,\"ReorderLevel\":25},{\"ProductID\":24,\"ProductName\":\"Guaraná Fantástica\",\"SupplierID\":10,\"CategoryID\":1,\"QuantityPerUnit\":\"12 - 355 ml cans\",\"UnitPrice\":4.5,\"UnitsInStock\":20,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":25,\"ProductName\":\"NuNuCa Nuß-Nougat-Creme\",\"SupplierID\":11,\"CategoryID\":3,\"QuantityPerUnit\":\"20 - 450 g glasses\",\"UnitPrice\":14.0,\"UnitsInStock\":76,\"UnitsOnOrder\":0,\"ReorderLevel\":30},{\"ProductID\":26,\"ProductName\":\"Gumbär Gummibärchen\",\"SupplierID\":11,\"CategoryID\":3,\"QuantityPerUnit\":\"100 - 250 g bags\",\"UnitPrice\":31.23,\"UnitsInStock\":15,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":27,\"ProductName\":\"Schoggi Schokolade\",\"SupplierID\":11,\"CategoryID\":3,\"QuantityPerUnit\":\"100 - 100 g pieces\",\"UnitPrice\":43.9,\"UnitsInStock\":49,\"UnitsOnOrder\":0,\"ReorderLevel\":30},{\"ProductID\":28,\"ProductName\":\"Rössle Sauerkraut\",\"SupplierID\":12,\"CategoryID\":7,\"QuantityPerUnit\":\"25 - 825 g cans\",\"UnitPrice\":45.6,\"UnitsInStock\":26,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":29,\"ProductName\":\"Thüringer Rostbratwurst\",\"SupplierID\":12,\"CategoryID\":6,\"QuantityPerUnit\":\"50 bags x 30 sausgs.\",\"UnitPrice\":123.79,\"UnitsInStock\":0,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":30,\"ProductName\":\"Nord-Ost Matjeshering\",\"SupplierID\":13,\"CategoryID\":8,\"QuantityPerUnit\":\"10 - 200 g glasses\",\"UnitPrice\":25.89,\"UnitsInStock\":10,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":31,\"ProductName\":\"Gorgonzola Telino\",\"SupplierID\":14,\"CategoryID\":4,\"QuantityPerUnit\":\"12 - 100 g pkgs\",\"UnitPrice\":12.5,\"UnitsInStock\":0,\"UnitsOnOrder\":70,\"ReorderLevel\":20},{\"ProductID\":32,\"ProductName\":\"Mascarpone Fabioli\",\"SupplierID\":14,\"CategoryID\":4,\"QuantityPerUnit\":\"24 - 200 g pkgs.\",\"UnitPrice\":32.0,\"UnitsInStock\":9,\"UnitsOnOrder\":40,\"ReorderLevel\":25},{\"ProductID\":33,\"ProductName\":\"Geitost\",\"SupplierID\":15,\"CategoryID\":4,\"QuantityPerUnit\":\"500 g\",\"UnitPrice\":2.5,\"UnitsInStock\":112,\"UnitsOnOrder\":0,\"ReorderLevel\":20},{\"ProductID\":34,\"ProductName\":\"Sasquatch Ale\",\"SupplierID\":16,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 12 oz bottles\",\"UnitPrice\":14.0,\"UnitsInStock\":111,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":35,\"ProductName\":\"Steeleye Stout\",\"SupplierID\":16,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 12 oz bottles\",\"UnitPrice\":18.0,\"UnitsInStock\":20,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":36,\"ProductName\":\"Inlagd Sill\",\"SupplierID\":17,\"CategoryID\":8,\"QuantityPerUnit\":\"24 - 250 g  jars\",\"UnitPrice\":19.0,\"UnitsInStock\":112,\"UnitsOnOrder\":0,\"ReorderLevel\":20},{\"ProductID\":37,\"ProductName\":\"Gravad lax\",\"SupplierID\":17,\"CategoryID\":8,\"QuantityPerUnit\":\"12 - 500 g pkgs.\",\"UnitPrice\":26.0,\"UnitsInStock\":11,\"UnitsOnOrder\":50,\"ReorderLevel\":25},{\"ProductID\":38,\"ProductName\":\"Côte de Blaye\",\"SupplierID\":18,\"CategoryID\":1,\"QuantityPerUnit\":\"12 - 75 cl bottles\",\"UnitPrice\":263.5,\"UnitsInStock\":17,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":39,\"ProductName\":\"Chartreuse verte\",\"SupplierID\":18,\"CategoryID\":1,\"QuantityPerUnit\":\"750 cc per bottle\",\"UnitPrice\":18.0,\"UnitsInStock\":69,\"UnitsOnOrder\":0,\"ReorderLevel\":5},{\"ProductID\":40,\"ProductName\":\"Boston Crab Meat\",\"SupplierID\":19,\"CategoryID\":8,\"QuantityPerUnit\":\"24 - 4 oz tins\",\"UnitPrice\":18.4,\"UnitsInStock\":123,\"UnitsOnOrder\":0,\"ReorderLevel\":30},{\"ProductID\":41,\"ProductName\":\"Jack's New England Clam Chowder\",\"SupplierID\":19,\"CategoryID\":8,\"QuantityPerUnit\":\"12 - 12 oz cans\",\"UnitPrice\":9.65,\"UnitsInStock\":85,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":42,\"ProductName\":\"Singaporean Hokkien Fried Mee\",\"SupplierID\":20,\"CategoryID\":5,\"QuantityPerUnit\":\"32 - 1 kg pkgs.\",\"UnitPrice\":14.0,\"UnitsInStock\":26,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":43,\"ProductName\":\"Ipoh Coffee\",\"SupplierID\":20,\"CategoryID\":1,\"QuantityPerUnit\":\"16 - 500 g tins\",\"UnitPrice\":46.0,\"UnitsInStock\":17,\"UnitsOnOrder\":10,\"ReorderLevel\":25},{\"ProductID\":44,\"ProductName\":\"Gula Malacca\",\"SupplierID\":20,\"CategoryID\":2,\"QuantityPerUnit\":\"20 - 2 kg bags\",\"UnitPrice\":19.45,\"UnitsInStock\":27,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":45,\"ProductName\":\"Rogede sild\",\"SupplierID\":21,\"CategoryID\":8,\"QuantityPerUnit\":\"1k pkg.\",\"UnitPrice\":9.5,\"UnitsInStock\":5,\"UnitsOnOrder\":70,\"ReorderLevel\":15},{\"ProductID\":46,\"ProductName\":\"Spegesild\",\"SupplierID\":21,\"CategoryID\":8,\"QuantityPerUnit\":\"4 - 450 g glasses\",\"UnitPrice\":12.0,\"UnitsInStock\":95,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":47,\"ProductName\":\"Zaanse koeken\",\"SupplierID\":22,\"CategoryID\":3,\"QuantityPerUnit\":\"10 - 4 oz boxes\",\"UnitPrice\":9.5,\"UnitsInStock\":36,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":48,\"ProductName\":\"Chocolade\",\"SupplierID\":22,\"CategoryID\":3,\"QuantityPerUnit\":\"10 pkgs.\",\"UnitPrice\":12.75,\"UnitsInStock\":15,\"UnitsOnOrder\":70,\"ReorderLevel\":25},{\"ProductID\":49,\"ProductName\":\"Maxilaku\",\"SupplierID\":23,\"CategoryID\":3,\"QuantityPerUnit\":\"24 - 50 g pkgs.\",\"UnitPrice\":20.0,\"UnitsInStock\":10,\"UnitsOnOrder\":60,\"ReorderLevel\":15},{\"ProductID\":50,\"ProductName\":\"Valkoinen suklaa\",\"SupplierID\":23,\"CategoryID\":3,\"QuantityPerUnit\":\"12 - 100 g bars\",\"UnitPrice\":16.25,\"UnitsInStock\":65,\"UnitsOnOrder\":0,\"ReorderLevel\":30},{\"ProductID\":51,\"ProductName\":\"Manjimup Dried Apples\",\"SupplierID\":24,\"CategoryID\":7,\"QuantityPerUnit\":\"50 - 300 g pkgs.\",\"UnitPrice\":53.0,\"UnitsInStock\":20,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":52,\"ProductName\":\"Filo Mix\",\"SupplierID\":24,\"CategoryID\":5,\"QuantityPerUnit\":\"16 - 2 kg boxes\",\"UnitPrice\":7.0,\"UnitsInStock\":38,\"UnitsOnOrder\":0,\"ReorderLevel\":25},{\"ProductID\":53,\"ProductName\":\"Perth Pasties\",\"SupplierID\":24,\"CategoryID\":6,\"QuantityPerUnit\":\"48 pieces\",\"UnitPrice\":32.8,\"UnitsInStock\":0,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":54,\"ProductName\":\"Tourtiere\",\"SupplierID\":25,\"CategoryID\":6,\"QuantityPerUnit\":\"16 pies\",\"UnitPrice\":7.45,\"UnitsInStock\":21,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":55,\"ProductName\":\"Pâté chinois\",\"SupplierID\":25,\"CategoryID\":6,\"QuantityPerUnit\":\"24 boxes x 2 pies\",\"UnitPrice\":24.0,\"UnitsInStock\":115,\"UnitsOnOrder\":0,\"ReorderLevel\":20},{\"ProductID\":56,\"ProductName\":\"Gnocchi di nonna Alice\",\"SupplierID\":26,\"CategoryID\":5,\"QuantityPerUnit\":\"24 - 250 g pkgs.\",\"UnitPrice\":38.0,\"UnitsInStock\":21,\"UnitsOnOrder\":10,\"ReorderLevel\":30},{\"ProductID\":57,\"ProductName\":\"Ravioli Angelo\",\"SupplierID\":26,\"CategoryID\":5,\"QuantityPerUnit\":\"24 - 250 g pkgs.\",\"UnitPrice\":19.5,\"UnitsInStock\":36,\"UnitsOnOrder\":0,\"ReorderLevel\":20},{\"ProductID\":58,\"ProductName\":\"Escargots de Bourgogne\",\"SupplierID\":27,\"CategoryID\":8,\"QuantityPerUnit\":\"24 pieces\",\"UnitPrice\":13.25,\"UnitsInStock\":62,\"UnitsOnOrder\":0,\"ReorderLevel\":20},{\"ProductID\":59,\"ProductName\":\"Raclette Courdavault\",\"SupplierID\":28,\"CategoryID\":4,\"QuantityPerUnit\":\"5 kg pkg.\",\"UnitPrice\":55.0,\"UnitsInStock\":79,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":60,\"ProductName\":\"Camembert Pierrot\",\"SupplierID\":28,\"CategoryID\":4,\"QuantityPerUnit\":\"15 - 300 g rounds\",\"UnitPrice\":34.0,\"UnitsInStock\":19,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":61,\"ProductName\":\"Sirop d'érable\",\"SupplierID\":29,\"CategoryID\":2,\"QuantityPerUnit\":\"24 - 500 ml bottles\",\"UnitPrice\":28.5,\"UnitsInStock\":113,\"UnitsOnOrder\":0,\"ReorderLevel\":25},{\"ProductID\":62,\"ProductName\":\"Tarte au sucre\",\"SupplierID\":29,\"CategoryID\":3,\"QuantityPerUnit\":\"48 pies\",\"UnitPrice\":49.3,\"UnitsInStock\":17,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":63,\"ProductName\":\"Vegie-spread\",\"SupplierID\":7,\"CategoryID\":2,\"QuantityPerUnit\":\"15 - 625 g jars\",\"UnitPrice\":43.9,\"UnitsInStock\":24,\"UnitsOnOrder\":0,\"ReorderLevel\":5},{\"ProductID\":64,\"ProductName\":\"Wimmers gute Semmelknödel\",\"SupplierID\":12,\"CategoryID\":5,\"QuantityPerUnit\":\"20 bags x 4 pieces\",\"UnitPrice\":33.25,\"UnitsInStock\":22,\"UnitsOnOrder\":80,\"ReorderLevel\":30},{\"ProductID\":65,\"ProductName\":\"Louisiana Fiery Hot Pepper Sauce\",\"SupplierID\":2,\"CategoryID\":2,\"QuantityPerUnit\":\"32 - 8 oz bottles\",\"UnitPrice\":21.05,\"UnitsInStock\":76,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":66,\"ProductName\":\"Louisiana Hot Spiced Okra\",\"SupplierID\":2,\"CategoryID\":2,\"QuantityPerUnit\":\"24 - 8 oz jars\",\"UnitPrice\":17.0,\"UnitsInStock\":4,\"UnitsOnOrder\":100,\"ReorderLevel\":20},{\"ProductID\":67,\"ProductName\":\"Laughing Lumberjack Lager\",\"SupplierID\":16,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 12 oz bottles\",\"UnitPrice\":14.0,\"UnitsInStock\":52,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":68,\"ProductName\":\"Scottish Longbreads\",\"SupplierID\":8,\"CategoryID\":3,\"QuantityPerUnit\":\"10 boxes x 8 pieces\",\"UnitPrice\":12.5,\"UnitsInStock\":6,\"UnitsOnOrder\":10,\"ReorderLevel\":15},{\"ProductID\":69,\"ProductName\":\"Gudbrandsdalsost\",\"SupplierID\":15,\"CategoryID\":4,\"QuantityPerUnit\":\"10 kg pkg.\",\"UnitPrice\":36.0,\"UnitsInStock\":26,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":70,\"ProductName\":\"Outback Lager\",\"SupplierID\":7,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 355 ml bottles\",\"UnitPrice\":15.0,\"UnitsInStock\":15,\"UnitsOnOrder\":10,\"ReorderLevel\":30},{\"ProductID\":71,\"ProductName\":\"Flotemysost\",\"SupplierID\":15,\"CategoryID\":4,\"QuantityPerUnit\":\"10 - 500 g pkgs.\",\"UnitPrice\":21.5,\"UnitsInStock\":26,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":72,\"ProductName\":\"Mozzarella di Giovanni\",\"SupplierID\":14,\"CategoryID\":4,\"QuantityPerUnit\":\"24 - 200 g pkgs.\",\"UnitPrice\":34.8,\"UnitsInStock\":14,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":73,\"ProductName\":\"Röd Kaviar\",\"SupplierID\":17,\"CategoryID\":8,\"QuantityPerUnit\":\"24 - 150 g jars\",\"UnitPrice\":15.0,\"UnitsInStock\":101,\"UnitsOnOrder\":0,\"ReorderLevel\":5},{\"ProductID\":74,\"ProductName\":\"Longlife Tofu\",\"SupplierID\":4,\"CategoryID\":7,\"QuantityPerUnit\":\"5 kg pkg.\",\"UnitPrice\":10.0,\"UnitsInStock\":4,\"UnitsOnOrder\":20,\"ReorderLevel\":5},{\"ProductID\":75,\"ProductName\":\"Rhönbräu Klosterbier\",\"SupplierID\":12,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 0.5 l bottles\",\"UnitPrice\":7.75,\"UnitsInStock\":125,\"UnitsOnOrder\":0,\"ReorderLevel\":25},{\"ProductID\":76,\"ProductName\":\"Lakkalikööri\",\"SupplierID\":23,\"CategoryID\":1,\"QuantityPerUnit\":\"500 ml\",\"UnitPrice\":18.0,\"UnitsInStock\":57,\"UnitsOnOrder\":0,\"ReorderLevel\":20},{\"ProductID\":77,\"ProductName\":\"Original Frankfurter grüne Soße\",\"SupplierID\":12,\"CategoryID\":2,\"QuantityPerUnit\":\"12 boxes\",\"UnitPrice\":13.0,\"UnitsInStock\":32,\"UnitsOnOrder\":0,\"ReorderLevel\":15}]"; 

            ICorrectness result = this.tester.TestQuery(
                 context =>
                    from product in context.Products
                    select product, 
                 expected);

            Assert.IsTrue(result.Check());
        }

        [Test]
        public void FindById()
        {
            string expected = "[{\"ProductID\":1,\"ProductName\":\"Chai\",\"SupplierID\":1,\"CategoryID\":1,\"QuantityPerUnit\":\"10 boxes x 20 bags\",\"UnitPrice\":18.0,\"UnitsInStock\":39,\"UnitsOnOrder\":0,\"ReorderLevel\":10}]";

            ICorrectness result = this.tester.TestQuery(
                context =>
                    from product in context.Products
                    where product.ProductID == 1
                    select product, 
                expected);

            Assert.IsTrue(result.Check());
        }

        [Test]
        public void OrderBy()
        {
            // Fails
            //   SQL Server:
            //      Rogede, Röd, Rössle
            //   NMemory: 
            //      Röd, Rogede, Rössle 

            // Workaround: change the culture settings
            // Solution: implement collation system in the database engine

            var culture = System.Threading.Thread.CurrentThread.CurrentCulture;
            System.Threading.Thread.CurrentThread.CurrentCulture =
                System.Globalization.CultureInfo.CreateSpecificCulture("HU-hu");

            string expected = "[{\"ProductID\":17,\"ProductName\":\"Alice Mutton\",\"SupplierID\":7,\"CategoryID\":6,\"QuantityPerUnit\":\"20 - 1 kg tins\",\"UnitPrice\":39.0,\"UnitsInStock\":0,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":3,\"ProductName\":\"Aniseed Syrup\",\"SupplierID\":1,\"CategoryID\":2,\"QuantityPerUnit\":\"12 - 550 ml bottles\",\"UnitPrice\":10.0,\"UnitsInStock\":13,\"UnitsOnOrder\":70,\"ReorderLevel\":25},{\"ProductID\":40,\"ProductName\":\"Boston Crab Meat\",\"SupplierID\":19,\"CategoryID\":8,\"QuantityPerUnit\":\"24 - 4 oz tins\",\"UnitPrice\":18.4,\"UnitsInStock\":123,\"UnitsOnOrder\":0,\"ReorderLevel\":30},{\"ProductID\":60,\"ProductName\":\"Camembert Pierrot\",\"SupplierID\":28,\"CategoryID\":4,\"QuantityPerUnit\":\"15 - 300 g rounds\",\"UnitPrice\":34.0,\"UnitsInStock\":19,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":18,\"ProductName\":\"Carnarvon Tigers\",\"SupplierID\":7,\"CategoryID\":8,\"QuantityPerUnit\":\"16 kg pkg.\",\"UnitPrice\":62.5,\"UnitsInStock\":42,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":1,\"ProductName\":\"Chai\",\"SupplierID\":1,\"CategoryID\":1,\"QuantityPerUnit\":\"10 boxes x 20 bags\",\"UnitPrice\":18.0,\"UnitsInStock\":39,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":2,\"ProductName\":\"Chang\",\"SupplierID\":1,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 12 oz bottles\",\"UnitPrice\":19.0,\"UnitsInStock\":17,\"UnitsOnOrder\":40,\"ReorderLevel\":25},{\"ProductID\":39,\"ProductName\":\"Chartreuse verte\",\"SupplierID\":18,\"CategoryID\":1,\"QuantityPerUnit\":\"750 cc per bottle\",\"UnitPrice\":18.0,\"UnitsInStock\":69,\"UnitsOnOrder\":0,\"ReorderLevel\":5},{\"ProductID\":4,\"ProductName\":\"Chef Anton's Cajun Seasoning\",\"SupplierID\":2,\"CategoryID\":2,\"QuantityPerUnit\":\"48 - 6 oz jars\",\"UnitPrice\":22.0,\"UnitsInStock\":53,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":5,\"ProductName\":\"Chef Anton's Gumbo Mix\",\"SupplierID\":2,\"CategoryID\":2,\"QuantityPerUnit\":\"36 boxes\",\"UnitPrice\":21.35,\"UnitsInStock\":0,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":48,\"ProductName\":\"Chocolade\",\"SupplierID\":22,\"CategoryID\":3,\"QuantityPerUnit\":\"10 pkgs.\",\"UnitPrice\":12.75,\"UnitsInStock\":15,\"UnitsOnOrder\":70,\"ReorderLevel\":25},{\"ProductID\":38,\"ProductName\":\"Côte de Blaye\",\"SupplierID\":18,\"CategoryID\":1,\"QuantityPerUnit\":\"12 - 75 cl bottles\",\"UnitPrice\":263.5,\"UnitsInStock\":17,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":58,\"ProductName\":\"Escargots de Bourgogne\",\"SupplierID\":27,\"CategoryID\":8,\"QuantityPerUnit\":\"24 pieces\",\"UnitPrice\":13.25,\"UnitsInStock\":62,\"UnitsOnOrder\":0,\"ReorderLevel\":20},{\"ProductID\":52,\"ProductName\":\"Filo Mix\",\"SupplierID\":24,\"CategoryID\":5,\"QuantityPerUnit\":\"16 - 2 kg boxes\",\"UnitPrice\":7.0,\"UnitsInStock\":38,\"UnitsOnOrder\":0,\"ReorderLevel\":25},{\"ProductID\":71,\"ProductName\":\"Flotemysost\",\"SupplierID\":15,\"CategoryID\":4,\"QuantityPerUnit\":\"10 - 500 g pkgs.\",\"UnitPrice\":21.5,\"UnitsInStock\":26,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":33,\"ProductName\":\"Geitost\",\"SupplierID\":15,\"CategoryID\":4,\"QuantityPerUnit\":\"500 g\",\"UnitPrice\":2.5,\"UnitsInStock\":112,\"UnitsOnOrder\":0,\"ReorderLevel\":20},{\"ProductID\":15,\"ProductName\":\"Genen Shouyu\",\"SupplierID\":6,\"CategoryID\":2,\"QuantityPerUnit\":\"24 - 250 ml bottles\",\"UnitPrice\":15.5,\"UnitsInStock\":39,\"UnitsOnOrder\":0,\"ReorderLevel\":5},{\"ProductID\":56,\"ProductName\":\"Gnocchi di nonna Alice\",\"SupplierID\":26,\"CategoryID\":5,\"QuantityPerUnit\":\"24 - 250 g pkgs.\",\"UnitPrice\":38.0,\"UnitsInStock\":21,\"UnitsOnOrder\":10,\"ReorderLevel\":30},{\"ProductID\":31,\"ProductName\":\"Gorgonzola Telino\",\"SupplierID\":14,\"CategoryID\":4,\"QuantityPerUnit\":\"12 - 100 g pkgs\",\"UnitPrice\":12.5,\"UnitsInStock\":0,\"UnitsOnOrder\":70,\"ReorderLevel\":20},{\"ProductID\":6,\"ProductName\":\"Grandma's Boysenberry Spread\",\"SupplierID\":3,\"CategoryID\":2,\"QuantityPerUnit\":\"12 - 8 oz jars\",\"UnitPrice\":25.0,\"UnitsInStock\":120,\"UnitsOnOrder\":0,\"ReorderLevel\":25},{\"ProductID\":37,\"ProductName\":\"Gravad lax\",\"SupplierID\":17,\"CategoryID\":8,\"QuantityPerUnit\":\"12 - 500 g pkgs.\",\"UnitPrice\":26.0,\"UnitsInStock\":11,\"UnitsOnOrder\":50,\"ReorderLevel\":25},{\"ProductID\":24,\"ProductName\":\"Guaraná Fantástica\",\"SupplierID\":10,\"CategoryID\":1,\"QuantityPerUnit\":\"12 - 355 ml cans\",\"UnitPrice\":4.5,\"UnitsInStock\":20,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":69,\"ProductName\":\"Gudbrandsdalsost\",\"SupplierID\":15,\"CategoryID\":4,\"QuantityPerUnit\":\"10 kg pkg.\",\"UnitPrice\":36.0,\"UnitsInStock\":26,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":44,\"ProductName\":\"Gula Malacca\",\"SupplierID\":20,\"CategoryID\":2,\"QuantityPerUnit\":\"20 - 2 kg bags\",\"UnitPrice\":19.45,\"UnitsInStock\":27,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":26,\"ProductName\":\"Gumbär Gummibärchen\",\"SupplierID\":11,\"CategoryID\":3,\"QuantityPerUnit\":\"100 - 250 g bags\",\"UnitPrice\":31.23,\"UnitsInStock\":15,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":22,\"ProductName\":\"Gustaf's Knäckebröd\",\"SupplierID\":9,\"CategoryID\":5,\"QuantityPerUnit\":\"24 - 500 g pkgs.\",\"UnitPrice\":21.0,\"UnitsInStock\":104,\"UnitsOnOrder\":0,\"ReorderLevel\":25},{\"ProductID\":10,\"ProductName\":\"Ikura\",\"SupplierID\":4,\"CategoryID\":8,\"QuantityPerUnit\":\"12 - 200 ml jars\",\"UnitPrice\":31.0,\"UnitsInStock\":31,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":36,\"ProductName\":\"Inlagd Sill\",\"SupplierID\":17,\"CategoryID\":8,\"QuantityPerUnit\":\"24 - 250 g  jars\",\"UnitPrice\":19.0,\"UnitsInStock\":112,\"UnitsOnOrder\":0,\"ReorderLevel\":20},{\"ProductID\":43,\"ProductName\":\"Ipoh Coffee\",\"SupplierID\":20,\"CategoryID\":1,\"QuantityPerUnit\":\"16 - 500 g tins\",\"UnitPrice\":46.0,\"UnitsInStock\":17,\"UnitsOnOrder\":10,\"ReorderLevel\":25},{\"ProductID\":41,\"ProductName\":\"Jack's New England Clam Chowder\",\"SupplierID\":19,\"CategoryID\":8,\"QuantityPerUnit\":\"12 - 12 oz cans\",\"UnitPrice\":9.65,\"UnitsInStock\":85,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":13,\"ProductName\":\"Konbu\",\"SupplierID\":6,\"CategoryID\":8,\"QuantityPerUnit\":\"2 kg box\",\"UnitPrice\":6.0,\"UnitsInStock\":24,\"UnitsOnOrder\":0,\"ReorderLevel\":5},{\"ProductID\":76,\"ProductName\":\"Lakkalikööri\",\"SupplierID\":23,\"CategoryID\":1,\"QuantityPerUnit\":\"500 ml\",\"UnitPrice\":18.0,\"UnitsInStock\":57,\"UnitsOnOrder\":0,\"ReorderLevel\":20},{\"ProductID\":67,\"ProductName\":\"Laughing Lumberjack Lager\",\"SupplierID\":16,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 12 oz bottles\",\"UnitPrice\":14.0,\"UnitsInStock\":52,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":74,\"ProductName\":\"Longlife Tofu\",\"SupplierID\":4,\"CategoryID\":7,\"QuantityPerUnit\":\"5 kg pkg.\",\"UnitPrice\":10.0,\"UnitsInStock\":4,\"UnitsOnOrder\":20,\"ReorderLevel\":5},{\"ProductID\":65,\"ProductName\":\"Louisiana Fiery Hot Pepper Sauce\",\"SupplierID\":2,\"CategoryID\":2,\"QuantityPerUnit\":\"32 - 8 oz bottles\",\"UnitPrice\":21.05,\"UnitsInStock\":76,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":66,\"ProductName\":\"Louisiana Hot Spiced Okra\",\"SupplierID\":2,\"CategoryID\":2,\"QuantityPerUnit\":\"24 - 8 oz jars\",\"UnitPrice\":17.0,\"UnitsInStock\":4,\"UnitsOnOrder\":100,\"ReorderLevel\":20},{\"ProductID\":51,\"ProductName\":\"Manjimup Dried Apples\",\"SupplierID\":24,\"CategoryID\":7,\"QuantityPerUnit\":\"50 - 300 g pkgs.\",\"UnitPrice\":53.0,\"UnitsInStock\":20,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":32,\"ProductName\":\"Mascarpone Fabioli\",\"SupplierID\":14,\"CategoryID\":4,\"QuantityPerUnit\":\"24 - 200 g pkgs.\",\"UnitPrice\":32.0,\"UnitsInStock\":9,\"UnitsOnOrder\":40,\"ReorderLevel\":25},{\"ProductID\":49,\"ProductName\":\"Maxilaku\",\"SupplierID\":23,\"CategoryID\":3,\"QuantityPerUnit\":\"24 - 50 g pkgs.\",\"UnitPrice\":20.0,\"UnitsInStock\":10,\"UnitsOnOrder\":60,\"ReorderLevel\":15},{\"ProductID\":9,\"ProductName\":\"Mishi Kobe Niku\",\"SupplierID\":4,\"CategoryID\":6,\"QuantityPerUnit\":\"18 - 500 g pkgs.\",\"UnitPrice\":97.0,\"UnitsInStock\":29,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":72,\"ProductName\":\"Mozzarella di Giovanni\",\"SupplierID\":14,\"CategoryID\":4,\"QuantityPerUnit\":\"24 - 200 g pkgs.\",\"UnitPrice\":34.8,\"UnitsInStock\":14,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":30,\"ProductName\":\"Nord-Ost Matjeshering\",\"SupplierID\":13,\"CategoryID\":8,\"QuantityPerUnit\":\"10 - 200 g glasses\",\"UnitPrice\":25.89,\"UnitsInStock\":10,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":8,\"ProductName\":\"Northwoods Cranberry Sauce\",\"SupplierID\":3,\"CategoryID\":2,\"QuantityPerUnit\":\"12 - 12 oz jars\",\"UnitPrice\":40.0,\"UnitsInStock\":6,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":25,\"ProductName\":\"NuNuCa Nuß-Nougat-Creme\",\"SupplierID\":11,\"CategoryID\":3,\"QuantityPerUnit\":\"20 - 450 g glasses\",\"UnitPrice\":14.0,\"UnitsInStock\":76,\"UnitsOnOrder\":0,\"ReorderLevel\":30},{\"ProductID\":77,\"ProductName\":\"Original Frankfurter grüne Soße\",\"SupplierID\":12,\"CategoryID\":2,\"QuantityPerUnit\":\"12 boxes\",\"UnitPrice\":13.0,\"UnitsInStock\":32,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":70,\"ProductName\":\"Outback Lager\",\"SupplierID\":7,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 355 ml bottles\",\"UnitPrice\":15.0,\"UnitsInStock\":15,\"UnitsOnOrder\":10,\"ReorderLevel\":30},{\"ProductID\":55,\"ProductName\":\"Pâté chinois\",\"SupplierID\":25,\"CategoryID\":6,\"QuantityPerUnit\":\"24 boxes x 2 pies\",\"UnitPrice\":24.0,\"UnitsInStock\":115,\"UnitsOnOrder\":0,\"ReorderLevel\":20},{\"ProductID\":16,\"ProductName\":\"Pavlova\",\"SupplierID\":7,\"CategoryID\":3,\"QuantityPerUnit\":\"32 - 500 g boxes\",\"UnitPrice\":17.45,\"UnitsInStock\":29,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":53,\"ProductName\":\"Perth Pasties\",\"SupplierID\":24,\"CategoryID\":6,\"QuantityPerUnit\":\"48 pieces\",\"UnitPrice\":32.8,\"UnitsInStock\":0,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":11,\"ProductName\":\"Queso Cabrales\",\"SupplierID\":5,\"CategoryID\":4,\"QuantityPerUnit\":\"1 kg pkg.\",\"UnitPrice\":21.0,\"UnitsInStock\":22,\"UnitsOnOrder\":30,\"ReorderLevel\":30},{\"ProductID\":12,\"ProductName\":\"Queso Manchego La Pastora\",\"SupplierID\":5,\"CategoryID\":4,\"QuantityPerUnit\":\"10 - 500 g pkgs.\",\"UnitPrice\":38.0,\"UnitsInStock\":86,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":59,\"ProductName\":\"Raclette Courdavault\",\"SupplierID\":28,\"CategoryID\":4,\"QuantityPerUnit\":\"5 kg pkg.\",\"UnitPrice\":55.0,\"UnitsInStock\":79,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":57,\"ProductName\":\"Ravioli Angelo\",\"SupplierID\":26,\"CategoryID\":5,\"QuantityPerUnit\":\"24 - 250 g pkgs.\",\"UnitPrice\":19.5,\"UnitsInStock\":36,\"UnitsOnOrder\":0,\"ReorderLevel\":20},{\"ProductID\":75,\"ProductName\":\"Rhönbräu Klosterbier\",\"SupplierID\":12,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 0.5 l bottles\",\"UnitPrice\":7.75,\"UnitsInStock\":125,\"UnitsOnOrder\":0,\"ReorderLevel\":25},{\"ProductID\":45,\"ProductName\":\"Rogede sild\",\"SupplierID\":21,\"CategoryID\":8,\"QuantityPerUnit\":\"1k pkg.\",\"UnitPrice\":9.5,\"UnitsInStock\":5,\"UnitsOnOrder\":70,\"ReorderLevel\":15},{\"ProductID\":73,\"ProductName\":\"Röd Kaviar\",\"SupplierID\":17,\"CategoryID\":8,\"QuantityPerUnit\":\"24 - 150 g jars\",\"UnitPrice\":15.0,\"UnitsInStock\":101,\"UnitsOnOrder\":0,\"ReorderLevel\":5},{\"ProductID\":28,\"ProductName\":\"Rössle Sauerkraut\",\"SupplierID\":12,\"CategoryID\":7,\"QuantityPerUnit\":\"25 - 825 g cans\",\"UnitPrice\":45.6,\"UnitsInStock\":26,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":34,\"ProductName\":\"Sasquatch Ale\",\"SupplierID\":16,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 12 oz bottles\",\"UnitPrice\":14.0,\"UnitsInStock\":111,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":27,\"ProductName\":\"Schoggi Schokolade\",\"SupplierID\":11,\"CategoryID\":3,\"QuantityPerUnit\":\"100 - 100 g pieces\",\"UnitPrice\":43.9,\"UnitsInStock\":49,\"UnitsOnOrder\":0,\"ReorderLevel\":30},{\"ProductID\":68,\"ProductName\":\"Scottish Longbreads\",\"SupplierID\":8,\"CategoryID\":3,\"QuantityPerUnit\":\"10 boxes x 8 pieces\",\"UnitPrice\":12.5,\"UnitsInStock\":6,\"UnitsOnOrder\":10,\"ReorderLevel\":15},{\"ProductID\":42,\"ProductName\":\"Singaporean Hokkien Fried Mee\",\"SupplierID\":20,\"CategoryID\":5,\"QuantityPerUnit\":\"32 - 1 kg pkgs.\",\"UnitPrice\":14.0,\"UnitsInStock\":26,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":20,\"ProductName\":\"Sir Rodney's Marmalade\",\"SupplierID\":8,\"CategoryID\":3,\"QuantityPerUnit\":\"30 gift boxes\",\"UnitPrice\":81.0,\"UnitsInStock\":40,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":21,\"ProductName\":\"Sir Rodney's Scones\",\"SupplierID\":8,\"CategoryID\":3,\"QuantityPerUnit\":\"24 pkgs. x 4 pieces\",\"UnitPrice\":10.0,\"UnitsInStock\":3,\"UnitsOnOrder\":40,\"ReorderLevel\":5},{\"ProductID\":61,\"ProductName\":\"Sirop d'érable\",\"SupplierID\":29,\"CategoryID\":2,\"QuantityPerUnit\":\"24 - 500 ml bottles\",\"UnitPrice\":28.5,\"UnitsInStock\":113,\"UnitsOnOrder\":0,\"ReorderLevel\":25},{\"ProductID\":46,\"ProductName\":\"Spegesild\",\"SupplierID\":21,\"CategoryID\":8,\"QuantityPerUnit\":\"4 - 450 g glasses\",\"UnitPrice\":12.0,\"UnitsInStock\":95,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":35,\"ProductName\":\"Steeleye Stout\",\"SupplierID\":16,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 12 oz bottles\",\"UnitPrice\":18.0,\"UnitsInStock\":20,\"UnitsOnOrder\":0,\"ReorderLevel\":15},{\"ProductID\":62,\"ProductName\":\"Tarte au sucre\",\"SupplierID\":29,\"CategoryID\":3,\"QuantityPerUnit\":\"48 pies\",\"UnitPrice\":49.3,\"UnitsInStock\":17,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":19,\"ProductName\":\"Teatime Chocolate Biscuits\",\"SupplierID\":8,\"CategoryID\":3,\"QuantityPerUnit\":\"10 boxes x 12 pieces\",\"UnitPrice\":9.2,\"UnitsInStock\":25,\"UnitsOnOrder\":0,\"ReorderLevel\":5},{\"ProductID\":29,\"ProductName\":\"Thüringer Rostbratwurst\",\"SupplierID\":12,\"CategoryID\":6,\"QuantityPerUnit\":\"50 bags x 30 sausgs.\",\"UnitPrice\":123.79,\"UnitsInStock\":0,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":14,\"ProductName\":\"Tofu\",\"SupplierID\":6,\"CategoryID\":7,\"QuantityPerUnit\":\"40 - 100 g pkgs.\",\"UnitPrice\":23.25,\"UnitsInStock\":35,\"UnitsOnOrder\":0,\"ReorderLevel\":0},{\"ProductID\":54,\"ProductName\":\"Tourtiere\",\"SupplierID\":25,\"CategoryID\":6,\"QuantityPerUnit\":\"16 pies\",\"UnitPrice\":7.45,\"UnitsInStock\":21,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":23,\"ProductName\":\"Tunnbröd\",\"SupplierID\":9,\"CategoryID\":5,\"QuantityPerUnit\":\"12 - 250 g pkgs.\",\"UnitPrice\":9.0,\"UnitsInStock\":61,\"UnitsOnOrder\":0,\"ReorderLevel\":25},{\"ProductID\":7,\"ProductName\":\"Uncle Bob's Organic Dried Pears\",\"SupplierID\":3,\"CategoryID\":7,\"QuantityPerUnit\":\"12 - 1 lb pkgs.\",\"UnitPrice\":30.0,\"UnitsInStock\":15,\"UnitsOnOrder\":0,\"ReorderLevel\":10},{\"ProductID\":50,\"ProductName\":\"Valkoinen suklaa\",\"SupplierID\":23,\"CategoryID\":3,\"QuantityPerUnit\":\"12 - 100 g bars\",\"UnitPrice\":16.25,\"UnitsInStock\":65,\"UnitsOnOrder\":0,\"ReorderLevel\":30},{\"ProductID\":63,\"ProductName\":\"Vegie-spread\",\"SupplierID\":7,\"CategoryID\":2,\"QuantityPerUnit\":\"15 - 625 g jars\",\"UnitPrice\":43.9,\"UnitsInStock\":24,\"UnitsOnOrder\":0,\"ReorderLevel\":5},{\"ProductID\":64,\"ProductName\":\"Wimmers gute Semmelknödel\",\"SupplierID\":12,\"CategoryID\":5,\"QuantityPerUnit\":\"20 bags x 4 pieces\",\"UnitPrice\":33.25,\"UnitsInStock\":22,\"UnitsOnOrder\":80,\"ReorderLevel\":30},{\"ProductID\":47,\"ProductName\":\"Zaanse koeken\",\"SupplierID\":22,\"CategoryID\":3,\"QuantityPerUnit\":\"10 - 4 oz boxes\",\"UnitPrice\":9.5,\"UnitsInStock\":36,\"UnitsOnOrder\":0,\"ReorderLevel\":0}]";

            ICorrectness result = this.tester.TestQuery(
                context =>
                    from product in context.Products
                    orderby product.ProductName
                    select product, 
                expected, 
                true);

            System.Threading.Thread.CurrentThread.CurrentCulture = culture;

            Assert.IsTrue(result.Check());
        }

        [Test]
        public void Projection()
        {
            string expected = "[{\"FirstName\":\"Nancy\",\"LastName\":\"Davolio\"},{\"FirstName\":\"Andrew\",\"LastName\":\"Fuller\"},{\"FirstName\":\"Janet\",\"LastName\":\"Leverling\"},{\"FirstName\":\"Margaret\",\"LastName\":\"Peacock\"},{\"FirstName\":\"Steven\",\"LastName\":\"Buchanan\"},{\"FirstName\":\"Michael\",\"LastName\":\"Suyama\"},{\"FirstName\":\"Robert\",\"LastName\":\"King\"},{\"FirstName\":\"Laura\",\"LastName\":\"Callahan\"},{\"FirstName\":\"Anne\",\"LastName\":\"Dodsworth\"}]";

            ICorrectness result = this.tester.TestQuery(
                context =>
                    from employee in context.Employees
                    select new 
                    { 
                        FirstName = employee.FirstName, 
                        LastName = employee.LastName 
                    }, 
                expected);

            Assert.IsTrue(result.Check());
        }

        [Test]
        public void QueryParameter()
        {
            string expected = "[{\"ProductID\":1,\"ProductName\":\"Chai\",\"SupplierID\":1,\"CategoryID\":1,\"QuantityPerUnit\":\"10 boxes x 20 bags\",\"UnitPrice\":18.0,\"UnitsInStock\":39,\"UnitsOnOrder\":0,\"ReorderLevel\":10}]";

            int id = 1;

            ICorrectness result = this.tester.TestQuery(
                context =>
                    from product in context.Products
                    where product.ProductID == id
                    select product, 
                expected);

            Assert.IsTrue(result.Check());
        }

        [Test]
        public void NullableQueryParameter()
        {
            string expected = "[]";

            int? id = null;

            ICorrectness result = this.tester.TestQuery(
                context =>
                    from product in context.Products
                    where product.ProductID == id
                    select product,
                expected);

            Assert.IsTrue(result.Check());
        }

        [Test]
        public void QueryParameterChange()
        {
            List<string> expected = new List<string>();

            expected.Add("[{\"ProductID\":1,\"ProductName\":\"Chai\",\"SupplierID\":1,\"CategoryID\":1,\"QuantityPerUnit\":\"10 boxes x 20 bags\",\"UnitPrice\":18.0,\"UnitsInStock\":39,\"UnitsOnOrder\":0,\"ReorderLevel\":10}]");
            expected.Add("[{\"ProductID\":2,\"ProductName\":\"Chang\",\"SupplierID\":1,\"CategoryID\":1,\"QuantityPerUnit\":\"24 - 12 oz bottles\",\"UnitPrice\":19.0,\"UnitsInStock\":17,\"UnitsOnOrder\":40,\"ReorderLevel\":25}]");

            List<int> idList = new List<int>();
            idList.Add(1);
            idList.Add(2);

            for (int i = 0; i < idList.Count; i++)
            {
                int id = idList[i];

                ICorrectness result = this.tester.TestQuery(
                    context =>
                        from product in context.Products
                        where product.ProductID == id
                        select product, 
                    expected[i]);

                Assert.IsTrue(result.Check());
            }
        }

        [Test]
        public void UnionAll()
        {
            string expected = "[{\"C1\":1,\"C2\":\"Chai\",\"C3\":1,\"C4\":1,\"C5\":\"10 boxes x 20 bags\",\"C6\":18.0,\"C7\":39,\"C8\":0,\"C9\":10},{\"C1\":2,\"C2\":\"Chang\",\"C3\":1,\"C4\":1,\"C5\":\"24 - 12 oz bottles\",\"C6\":19.0,\"C7\":17,\"C8\":40,\"C9\":25},{\"C1\":3,\"C2\":\"Aniseed Syrup\",\"C3\":1,\"C4\":2,\"C5\":\"12 - 550 ml bottles\",\"C6\":10.0,\"C7\":13,\"C8\":70,\"C9\":25},{\"C1\":4,\"C2\":\"Chef Anton's Cajun Seasoning\",\"C3\":2,\"C4\":2,\"C5\":\"48 - 6 oz jars\",\"C6\":22.0,\"C7\":53,\"C8\":0,\"C9\":0},{\"C1\":5,\"C2\":\"Chef Anton's Gumbo Mix\",\"C3\":2,\"C4\":2,\"C5\":\"36 boxes\",\"C6\":21.35,\"C7\":0,\"C8\":0,\"C9\":0},{\"C1\":6,\"C2\":\"Grandma's Boysenberry Spread\",\"C3\":3,\"C4\":2,\"C5\":\"12 - 8 oz jars\",\"C6\":25.0,\"C7\":120,\"C8\":0,\"C9\":25},{\"C1\":7,\"C2\":\"Uncle Bob's Organic Dried Pears\",\"C3\":3,\"C4\":7,\"C5\":\"12 - 1 lb pkgs.\",\"C6\":30.0,\"C7\":15,\"C8\":0,\"C9\":10},{\"C1\":8,\"C2\":\"Northwoods Cranberry Sauce\",\"C3\":3,\"C4\":2,\"C5\":\"12 - 12 oz jars\",\"C6\":40.0,\"C7\":6,\"C8\":0,\"C9\":0},{\"C1\":9,\"C2\":\"Mishi Kobe Niku\",\"C3\":4,\"C4\":6,\"C5\":\"18 - 500 g pkgs.\",\"C6\":97.0,\"C7\":29,\"C8\":0,\"C9\":0},{\"C1\":10,\"C2\":\"Ikura\",\"C3\":4,\"C4\":8,\"C5\":\"12 - 200 ml jars\",\"C6\":31.0,\"C7\":31,\"C8\":0,\"C9\":0},{\"C1\":11,\"C2\":\"Queso Cabrales\",\"C3\":5,\"C4\":4,\"C5\":\"1 kg pkg.\",\"C6\":21.0,\"C7\":22,\"C8\":30,\"C9\":30},{\"C1\":12,\"C2\":\"Queso Manchego La Pastora\",\"C3\":5,\"C4\":4,\"C5\":\"10 - 500 g pkgs.\",\"C6\":38.0,\"C7\":86,\"C8\":0,\"C9\":0},{\"C1\":13,\"C2\":\"Konbu\",\"C3\":6,\"C4\":8,\"C5\":\"2 kg box\",\"C6\":6.0,\"C7\":24,\"C8\":0,\"C9\":5},{\"C1\":14,\"C2\":\"Tofu\",\"C3\":6,\"C4\":7,\"C5\":\"40 - 100 g pkgs.\",\"C6\":23.25,\"C7\":35,\"C8\":0,\"C9\":0},{\"C1\":15,\"C2\":\"Genen Shouyu\",\"C3\":6,\"C4\":2,\"C5\":\"24 - 250 ml bottles\",\"C6\":15.5,\"C7\":39,\"C8\":0,\"C9\":5},{\"C1\":16,\"C2\":\"Pavlova\",\"C3\":7,\"C4\":3,\"C5\":\"32 - 500 g boxes\",\"C6\":17.45,\"C7\":29,\"C8\":0,\"C9\":10},{\"C1\":17,\"C2\":\"Alice Mutton\",\"C3\":7,\"C4\":6,\"C5\":\"20 - 1 kg tins\",\"C6\":39.0,\"C7\":0,\"C8\":0,\"C9\":0},{\"C1\":18,\"C2\":\"Carnarvon Tigers\",\"C3\":7,\"C4\":8,\"C5\":\"16 kg pkg.\",\"C6\":62.5,\"C7\":42,\"C8\":0,\"C9\":0},{\"C1\":19,\"C2\":\"Teatime Chocolate Biscuits\",\"C3\":8,\"C4\":3,\"C5\":\"10 boxes x 12 pieces\",\"C6\":9.2,\"C7\":25,\"C8\":0,\"C9\":5},{\"C1\":20,\"C2\":\"Sir Rodney's Marmalade\",\"C3\":8,\"C4\":3,\"C5\":\"30 gift boxes\",\"C6\":81.0,\"C7\":40,\"C8\":0,\"C9\":0},{\"C1\":21,\"C2\":\"Sir Rodney's Scones\",\"C3\":8,\"C4\":3,\"C5\":\"24 pkgs. x 4 pieces\",\"C6\":10.0,\"C7\":3,\"C8\":40,\"C9\":5},{\"C1\":22,\"C2\":\"Gustaf's Knäckebröd\",\"C3\":9,\"C4\":5,\"C5\":\"24 - 500 g pkgs.\",\"C6\":21.0,\"C7\":104,\"C8\":0,\"C9\":25},{\"C1\":23,\"C2\":\"Tunnbröd\",\"C3\":9,\"C4\":5,\"C5\":\"12 - 250 g pkgs.\",\"C6\":9.0,\"C7\":61,\"C8\":0,\"C9\":25},{\"C1\":24,\"C2\":\"Guaraná Fantástica\",\"C3\":10,\"C4\":1,\"C5\":\"12 - 355 ml cans\",\"C6\":4.5,\"C7\":20,\"C8\":0,\"C9\":0},{\"C1\":25,\"C2\":\"NuNuCa Nuß-Nougat-Creme\",\"C3\":11,\"C4\":3,\"C5\":\"20 - 450 g glasses\",\"C6\":14.0,\"C7\":76,\"C8\":0,\"C9\":30},{\"C1\":26,\"C2\":\"Gumbär Gummibärchen\",\"C3\":11,\"C4\":3,\"C5\":\"100 - 250 g bags\",\"C6\":31.23,\"C7\":15,\"C8\":0,\"C9\":0},{\"C1\":27,\"C2\":\"Schoggi Schokolade\",\"C3\":11,\"C4\":3,\"C5\":\"100 - 100 g pieces\",\"C6\":43.9,\"C7\":49,\"C8\":0,\"C9\":30},{\"C1\":28,\"C2\":\"Rössle Sauerkraut\",\"C3\":12,\"C4\":7,\"C5\":\"25 - 825 g cans\",\"C6\":45.6,\"C7\":26,\"C8\":0,\"C9\":0},{\"C1\":29,\"C2\":\"Thüringer Rostbratwurst\",\"C3\":12,\"C4\":6,\"C5\":\"50 bags x 30 sausgs.\",\"C6\":123.79,\"C7\":0,\"C8\":0,\"C9\":0},{\"C1\":30,\"C2\":\"Nord-Ost Matjeshering\",\"C3\":13,\"C4\":8,\"C5\":\"10 - 200 g glasses\",\"C6\":25.89,\"C7\":10,\"C8\":0,\"C9\":15},{\"C1\":31,\"C2\":\"Gorgonzola Telino\",\"C3\":14,\"C4\":4,\"C5\":\"12 - 100 g pkgs\",\"C6\":12.5,\"C7\":0,\"C8\":70,\"C9\":20},{\"C1\":32,\"C2\":\"Mascarpone Fabioli\",\"C3\":14,\"C4\":4,\"C5\":\"24 - 200 g pkgs.\",\"C6\":32.0,\"C7\":9,\"C8\":40,\"C9\":25},{\"C1\":33,\"C2\":\"Geitost\",\"C3\":15,\"C4\":4,\"C5\":\"500 g\",\"C6\":2.5,\"C7\":112,\"C8\":0,\"C9\":20},{\"C1\":34,\"C2\":\"Sasquatch Ale\",\"C3\":16,\"C4\":1,\"C5\":\"24 - 12 oz bottles\",\"C6\":14.0,\"C7\":111,\"C8\":0,\"C9\":15},{\"C1\":35,\"C2\":\"Steeleye Stout\",\"C3\":16,\"C4\":1,\"C5\":\"24 - 12 oz bottles\",\"C6\":18.0,\"C7\":20,\"C8\":0,\"C9\":15},{\"C1\":36,\"C2\":\"Inlagd Sill\",\"C3\":17,\"C4\":8,\"C5\":\"24 - 250 g  jars\",\"C6\":19.0,\"C7\":112,\"C8\":0,\"C9\":20},{\"C1\":37,\"C2\":\"Gravad lax\",\"C3\":17,\"C4\":8,\"C5\":\"12 - 500 g pkgs.\",\"C6\":26.0,\"C7\":11,\"C8\":50,\"C9\":25},{\"C1\":38,\"C2\":\"Côte de Blaye\",\"C3\":18,\"C4\":1,\"C5\":\"12 - 75 cl bottles\",\"C6\":263.5,\"C7\":17,\"C8\":0,\"C9\":15},{\"C1\":39,\"C2\":\"Chartreuse verte\",\"C3\":18,\"C4\":1,\"C5\":\"750 cc per bottle\",\"C6\":18.0,\"C7\":69,\"C8\":0,\"C9\":5},{\"C1\":40,\"C2\":\"Boston Crab Meat\",\"C3\":19,\"C4\":8,\"C5\":\"24 - 4 oz tins\",\"C6\":18.4,\"C7\":123,\"C8\":0,\"C9\":30},{\"C1\":41,\"C2\":\"Jack's New England Clam Chowder\",\"C3\":19,\"C4\":8,\"C5\":\"12 - 12 oz cans\",\"C6\":9.65,\"C7\":85,\"C8\":0,\"C9\":10},{\"C1\":42,\"C2\":\"Singaporean Hokkien Fried Mee\",\"C3\":20,\"C4\":5,\"C5\":\"32 - 1 kg pkgs.\",\"C6\":14.0,\"C7\":26,\"C8\":0,\"C9\":0},{\"C1\":43,\"C2\":\"Ipoh Coffee\",\"C3\":20,\"C4\":1,\"C5\":\"16 - 500 g tins\",\"C6\":46.0,\"C7\":17,\"C8\":10,\"C9\":25},{\"C1\":44,\"C2\":\"Gula Malacca\",\"C3\":20,\"C4\":2,\"C5\":\"20 - 2 kg bags\",\"C6\":19.45,\"C7\":27,\"C8\":0,\"C9\":15},{\"C1\":45,\"C2\":\"Rogede sild\",\"C3\":21,\"C4\":8,\"C5\":\"1k pkg.\",\"C6\":9.5,\"C7\":5,\"C8\":70,\"C9\":15},{\"C1\":46,\"C2\":\"Spegesild\",\"C3\":21,\"C4\":8,\"C5\":\"4 - 450 g glasses\",\"C6\":12.0,\"C7\":95,\"C8\":0,\"C9\":0},{\"C1\":47,\"C2\":\"Zaanse koeken\",\"C3\":22,\"C4\":3,\"C5\":\"10 - 4 oz boxes\",\"C6\":9.5,\"C7\":36,\"C8\":0,\"C9\":0},{\"C1\":48,\"C2\":\"Chocolade\",\"C3\":22,\"C4\":3,\"C5\":\"10 pkgs.\",\"C6\":12.75,\"C7\":15,\"C8\":70,\"C9\":25},{\"C1\":49,\"C2\":\"Maxilaku\",\"C3\":23,\"C4\":3,\"C5\":\"24 - 50 g pkgs.\",\"C6\":20.0,\"C7\":10,\"C8\":60,\"C9\":15},{\"C1\":50,\"C2\":\"Valkoinen suklaa\",\"C3\":23,\"C4\":3,\"C5\":\"12 - 100 g bars\",\"C6\":16.25,\"C7\":65,\"C8\":0,\"C9\":30},{\"C1\":51,\"C2\":\"Manjimup Dried Apples\",\"C3\":24,\"C4\":7,\"C5\":\"50 - 300 g pkgs.\",\"C6\":53.0,\"C7\":20,\"C8\":0,\"C9\":10},{\"C1\":52,\"C2\":\"Filo Mix\",\"C3\":24,\"C4\":5,\"C5\":\"16 - 2 kg boxes\",\"C6\":7.0,\"C7\":38,\"C8\":0,\"C9\":25},{\"C1\":53,\"C2\":\"Perth Pasties\",\"C3\":24,\"C4\":6,\"C5\":\"48 pieces\",\"C6\":32.8,\"C7\":0,\"C8\":0,\"C9\":0},{\"C1\":54,\"C2\":\"Tourtiere\",\"C3\":25,\"C4\":6,\"C5\":\"16 pies\",\"C6\":7.45,\"C7\":21,\"C8\":0,\"C9\":10},{\"C1\":55,\"C2\":\"Pâté chinois\",\"C3\":25,\"C4\":6,\"C5\":\"24 boxes x 2 pies\",\"C6\":24.0,\"C7\":115,\"C8\":0,\"C9\":20},{\"C1\":56,\"C2\":\"Gnocchi di nonna Alice\",\"C3\":26,\"C4\":5,\"C5\":\"24 - 250 g pkgs.\",\"C6\":38.0,\"C7\":21,\"C8\":10,\"C9\":30},{\"C1\":57,\"C2\":\"Ravioli Angelo\",\"C3\":26,\"C4\":5,\"C5\":\"24 - 250 g pkgs.\",\"C6\":19.5,\"C7\":36,\"C8\":0,\"C9\":20},{\"C1\":58,\"C2\":\"Escargots de Bourgogne\",\"C3\":27,\"C4\":8,\"C5\":\"24 pieces\",\"C6\":13.25,\"C7\":62,\"C8\":0,\"C9\":20},{\"C1\":59,\"C2\":\"Raclette Courdavault\",\"C3\":28,\"C4\":4,\"C5\":\"5 kg pkg.\",\"C6\":55.0,\"C7\":79,\"C8\":0,\"C9\":0},{\"C1\":60,\"C2\":\"Camembert Pierrot\",\"C3\":28,\"C4\":4,\"C5\":\"15 - 300 g rounds\",\"C6\":34.0,\"C7\":19,\"C8\":0,\"C9\":0},{\"C1\":61,\"C2\":\"Sirop d'érable\",\"C3\":29,\"C4\":2,\"C5\":\"24 - 500 ml bottles\",\"C6\":28.5,\"C7\":113,\"C8\":0,\"C9\":25},{\"C1\":62,\"C2\":\"Tarte au sucre\",\"C3\":29,\"C4\":3,\"C5\":\"48 pies\",\"C6\":49.3,\"C7\":17,\"C8\":0,\"C9\":0},{\"C1\":63,\"C2\":\"Vegie-spread\",\"C3\":7,\"C4\":2,\"C5\":\"15 - 625 g jars\",\"C6\":43.9,\"C7\":24,\"C8\":0,\"C9\":5},{\"C1\":64,\"C2\":\"Wimmers gute Semmelknödel\",\"C3\":12,\"C4\":5,\"C5\":\"20 bags x 4 pieces\",\"C6\":33.25,\"C7\":22,\"C8\":80,\"C9\":30},{\"C1\":65,\"C2\":\"Louisiana Fiery Hot Pepper Sauce\",\"C3\":2,\"C4\":2,\"C5\":\"32 - 8 oz bottles\",\"C6\":21.05,\"C7\":76,\"C8\":0,\"C9\":0},{\"C1\":66,\"C2\":\"Louisiana Hot Spiced Okra\",\"C3\":2,\"C4\":2,\"C5\":\"24 - 8 oz jars\",\"C6\":17.0,\"C7\":4,\"C8\":100,\"C9\":20},{\"C1\":67,\"C2\":\"Laughing Lumberjack Lager\",\"C3\":16,\"C4\":1,\"C5\":\"24 - 12 oz bottles\",\"C6\":14.0,\"C7\":52,\"C8\":0,\"C9\":10},{\"C1\":68,\"C2\":\"Scottish Longbreads\",\"C3\":8,\"C4\":3,\"C5\":\"10 boxes x 8 pieces\",\"C6\":12.5,\"C7\":6,\"C8\":10,\"C9\":15},{\"C1\":69,\"C2\":\"Gudbrandsdalsost\",\"C3\":15,\"C4\":4,\"C5\":\"10 kg pkg.\",\"C6\":36.0,\"C7\":26,\"C8\":0,\"C9\":15},{\"C1\":70,\"C2\":\"Outback Lager\",\"C3\":7,\"C4\":1,\"C5\":\"24 - 355 ml bottles\",\"C6\":15.0,\"C7\":15,\"C8\":10,\"C9\":30},{\"C1\":71,\"C2\":\"Flotemysost\",\"C3\":15,\"C4\":4,\"C5\":\"10 - 500 g pkgs.\",\"C6\":21.5,\"C7\":26,\"C8\":0,\"C9\":0},{\"C1\":72,\"C2\":\"Mozzarella di Giovanni\",\"C3\":14,\"C4\":4,\"C5\":\"24 - 200 g pkgs.\",\"C6\":34.8,\"C7\":14,\"C8\":0,\"C9\":0},{\"C1\":73,\"C2\":\"Röd Kaviar\",\"C3\":17,\"C4\":8,\"C5\":\"24 - 150 g jars\",\"C6\":15.0,\"C7\":101,\"C8\":0,\"C9\":5},{\"C1\":74,\"C2\":\"Longlife Tofu\",\"C3\":4,\"C4\":7,\"C5\":\"5 kg pkg.\",\"C6\":10.0,\"C7\":4,\"C8\":20,\"C9\":5},{\"C1\":75,\"C2\":\"Rhönbräu Klosterbier\",\"C3\":12,\"C4\":1,\"C5\":\"24 - 0.5 l bottles\",\"C6\":7.75,\"C7\":125,\"C8\":0,\"C9\":25},{\"C1\":76,\"C2\":\"Lakkalikööri\",\"C3\":23,\"C4\":1,\"C5\":\"500 ml\",\"C6\":18.0,\"C7\":57,\"C8\":0,\"C9\":20},{\"C1\":77,\"C2\":\"Original Frankfurter grüne Soße\",\"C3\":12,\"C4\":2,\"C5\":\"12 boxes\",\"C6\":13.0,\"C7\":32,\"C8\":0,\"C9\":15},{\"C1\":1},{\"C1\":2},{\"C1\":3},{\"C1\":4},{\"C1\":5},{\"C1\":6},{\"C1\":7},{\"C1\":8},{\"C1\":9},{\"C1\":10},{\"C1\":11},{\"C1\":12},{\"C1\":13},{\"C1\":14},{\"C1\":15},{\"C1\":16},{\"C1\":17},{\"C1\":18},{\"C1\":19},{\"C1\":20},{\"C1\":21},{\"C1\":22},{\"C1\":23},{\"C1\":24},{\"C1\":25},{\"C1\":26},{\"C1\":27},{\"C1\":28},{\"C1\":29},{\"C1\":30},{\"C1\":31},{\"C1\":32},{\"C1\":33},{\"C1\":34},{\"C1\":35},{\"C1\":36},{\"C1\":37},{\"C1\":38},{\"C1\":39},{\"C1\":40},{\"C1\":41},{\"C1\":42},{\"C1\":43},{\"C1\":44},{\"C1\":45},{\"C1\":46},{\"C1\":47},{\"C1\":48},{\"C1\":49},{\"C1\":50},{\"C1\":51},{\"C1\":52},{\"C1\":53},{\"C1\":54},{\"C1\":55},{\"C1\":56},{\"C1\":57},{\"C1\":58},{\"C1\":59},{\"C1\":60},{\"C1\":61},{\"C1\":62},{\"C1\":63},{\"C1\":64},{\"C1\":65},{\"C1\":66},{\"C1\":67},{\"C1\":68},{\"C1\":69},{\"C1\":70},{\"C1\":71},{\"C1\":72},{\"C1\":73},{\"C1\":74},{\"C1\":75},{\"C1\":76},{\"C1\":77}]";
  
            ICorrectness result = this.tester.TestQuery(
                context =>
                    context.Products.Concat(context.Products), 
                expected);

            Assert.IsTrue(result.Check());
        }

        [Test]
        public void UnionAll2()
        {
            string expected = "[{\"C1\":1,\"C2\":\"Chai\",\"C3\":1,\"C4\":1,\"C5\":\"10 boxes x 20 bags\",\"C6\":18.0,\"C7\":39,\"C8\":0,\"C9\":10},{\"C1\":2,\"C2\":\"Chang\",\"C3\":1,\"C4\":1,\"C5\":\"24 - 12 oz bottles\",\"C6\":19.0,\"C7\":17,\"C8\":40,\"C9\":25},{\"C1\":3,\"C2\":\"Aniseed Syrup\",\"C3\":1,\"C4\":2,\"C5\":\"12 - 550 ml bottles\",\"C6\":10.0,\"C7\":13,\"C8\":70,\"C9\":25},{\"C1\":4,\"C2\":\"Chef Anton's Cajun Seasoning\",\"C3\":2,\"C4\":2,\"C5\":\"48 - 6 oz jars\",\"C6\":22.0,\"C7\":53,\"C8\":0,\"C9\":0},{\"C1\":11,\"C2\":\"Queso Cabrales\",\"C3\":5,\"C4\":4,\"C5\":\"1 kg pkg.\",\"C6\":21.0,\"C7\":22,\"C8\":30,\"C9\":30},{\"C1\":12,\"C2\":\"Queso Manchego La Pastora\",\"C3\":5,\"C4\":4,\"C5\":\"10 - 500 g pkgs.\",\"C6\":38.0,\"C7\":86,\"C8\":0,\"C9\":0},{\"C1\":13,\"C2\":\"Konbu\",\"C3\":6,\"C4\":8,\"C5\":\"2 kg box\",\"C6\":6.0,\"C7\":24,\"C8\":0,\"C9\":5},{\"C1\":14,\"C2\":\"Tofu\",\"C3\":6,\"C4\":7,\"C5\":\"40 - 100 g pkgs.\",\"C6\":23.25,\"C7\":35,\"C8\":0,\"C9\":0},{\"C1\":15,\"C2\":\"Genen Shouyu\",\"C3\":6,\"C4\":2,\"C5\":\"24 - 250 ml bottles\",\"C6\":15.5,\"C7\":39,\"C8\":0,\"C9\":5},{\"C1\":16,\"C2\":\"Pavlova\",\"C3\":7,\"C4\":3,\"C5\":\"32 - 500 g boxes\",\"C6\":17.45,\"C7\":29,\"C8\":0,\"C9\":10},{\"C1\":17,\"C2\":\"Alice Mutton\",\"C3\":7,\"C4\":6,\"C5\":\"20 - 1 kg tins\",\"C6\":39.0,\"C7\":0,\"C8\":0,\"C9\":0},{\"C1\":18,\"C2\":\"Carnarvon Tigers\",\"C3\":7,\"C4\":8,\"C5\":\"16 kg pkg.\",\"C6\":62.5,\"C7\":42,\"C8\":0,\"C9\":0},{\"C1\":19,\"C2\":\"Teatime Chocolate Biscuits\",\"C3\":8,\"C4\":3,\"C5\":\"10 boxes x 12 pieces\",\"C6\":9.2,\"C7\":25,\"C8\":0,\"C9\":5},{\"C1\":20,\"C2\":\"Sir Rodney's Marmalade\",\"C3\":8,\"C4\":3,\"C5\":\"30 gift boxes\",\"C6\":81.0,\"C7\":40,\"C8\":0,\"C9\":0},{\"C1\":21,\"C2\":\"Sir Rodney's Scones\",\"C3\":8,\"C4\":3,\"C5\":\"24 pkgs. x 4 pieces\",\"C6\":10.0,\"C7\":3,\"C8\":40,\"C9\":5},{\"C1\":22,\"C2\":\"Gustaf's Knäckebröd\",\"C3\":9,\"C4\":5,\"C5\":\"24 - 500 g pkgs.\",\"C6\":21.0,\"C7\":104,\"C8\":0,\"C9\":25},{\"C1\":23,\"C2\":\"Tunnbröd\",\"C3\":9,\"C4\":5,\"C5\":\"12 - 250 g pkgs.\",\"C6\":9.0,\"C7\":61,\"C8\":0,\"C9\":25},{\"C1\":24,\"C2\":\"Guaraná Fantástica\",\"C3\":10,\"C4\":1,\"C5\":\"12 - 355 ml cans\",\"C6\":4.5,\"C7\":20,\"C8\":0,\"C9\":0},{\"C1\":25,\"C2\":\"NuNuCa Nuß-Nougat-Creme\",\"C3\":11,\"C4\":3,\"C5\":\"20 - 450 g glasses\",\"C6\":14.0,\"C7\":76,\"C8\":0,\"C9\":30},{\"C1\":26,\"C2\":\"Gumbär Gummibärchen\",\"C3\":11,\"C4\":3,\"C5\":\"100 - 250 g bags\",\"C6\":31.23,\"C7\":15,\"C8\":0,\"C9\":0},{\"C1\":27,\"C2\":\"Schoggi Schokolade\",\"C3\":11,\"C4\":3,\"C5\":\"100 - 100 g pieces\",\"C6\":43.9,\"C7\":49,\"C8\":0,\"C9\":30},{\"C1\":28,\"C2\":\"Rössle Sauerkraut\",\"C3\":12,\"C4\":7,\"C5\":\"25 - 825 g cans\",\"C6\":45.6,\"C7\":26,\"C8\":0,\"C9\":0},{\"C1\":29,\"C2\":\"Thüringer Rostbratwurst\",\"C3\":12,\"C4\":6,\"C5\":\"50 bags x 30 sausgs.\",\"C6\":123.79,\"C7\":0,\"C8\":0,\"C9\":0},{\"C1\":30,\"C2\":\"Nord-Ost Matjeshering\",\"C3\":13,\"C4\":8,\"C5\":\"10 - 200 g glasses\",\"C6\":25.89,\"C7\":10,\"C8\":0,\"C9\":15},{\"C1\":31,\"C2\":\"Gorgonzola Telino\",\"C3\":14,\"C4\":4,\"C5\":\"12 - 100 g pkgs\",\"C6\":12.5,\"C7\":0,\"C8\":70,\"C9\":20},{\"C1\":32,\"C2\":\"Mascarpone Fabioli\",\"C3\":14,\"C4\":4,\"C5\":\"24 - 200 g pkgs.\",\"C6\":32.0,\"C7\":9,\"C8\":40,\"C9\":25},{\"C1\":33,\"C2\":\"Geitost\",\"C3\":15,\"C4\":4,\"C5\":\"500 g\",\"C6\":2.5,\"C7\":112,\"C8\":0,\"C9\":20},{\"C1\":34,\"C2\":\"Sasquatch Ale\",\"C3\":16,\"C4\":1,\"C5\":\"24 - 12 oz bottles\",\"C6\":14.0,\"C7\":111,\"C8\":0,\"C9\":15},{\"C1\":35,\"C2\":\"Steeleye Stout\",\"C3\":16,\"C4\":1,\"C5\":\"24 - 12 oz bottles\",\"C6\":18.0,\"C7\":20,\"C8\":0,\"C9\":15},{\"C1\":36,\"C2\":\"Inlagd Sill\",\"C3\":17,\"C4\":8,\"C5\":\"24 - 250 g  jars\",\"C6\":19.0,\"C7\":112,\"C8\":0,\"C9\":20},{\"C1\":37,\"C2\":\"Gravad lax\",\"C3\":17,\"C4\":8,\"C5\":\"12 - 500 g pkgs.\",\"C6\":26.0,\"C7\":11,\"C8\":50,\"C9\":25},{\"C1\":38,\"C2\":\"Côte de Blaye\",\"C3\":18,\"C4\":1,\"C5\":\"12 - 75 cl bottles\",\"C6\":263.5,\"C7\":17,\"C8\":0,\"C9\":15},{\"C1\":39,\"C2\":\"Chartreuse verte\",\"C3\":18,\"C4\":1,\"C5\":\"750 cc per bottle\",\"C6\":18.0,\"C7\":69,\"C8\":0,\"C9\":5},{\"C1\":40,\"C2\":\"Boston Crab Meat\",\"C3\":19,\"C4\":8,\"C5\":\"24 - 4 oz tins\",\"C6\":18.4,\"C7\":123,\"C8\":0,\"C9\":30},{\"C1\":41,\"C2\":\"Jack's New England Clam Chowder\",\"C3\":19,\"C4\":8,\"C5\":\"12 - 12 oz cans\",\"C6\":9.65,\"C7\":85,\"C8\":0,\"C9\":10},{\"C1\":42,\"C2\":\"Singaporean Hokkien Fried Mee\",\"C3\":20,\"C4\":5,\"C5\":\"32 - 1 kg pkgs.\",\"C6\":14.0,\"C7\":26,\"C8\":0,\"C9\":0},{\"C1\":43,\"C2\":\"Ipoh Coffee\",\"C3\":20,\"C4\":1,\"C5\":\"16 - 500 g tins\",\"C6\":46.0,\"C7\":17,\"C8\":10,\"C9\":25},{\"C1\":44,\"C2\":\"Gula Malacca\",\"C3\":20,\"C4\":2,\"C5\":\"20 - 2 kg bags\",\"C6\":19.45,\"C7\":27,\"C8\":0,\"C9\":15},{\"C1\":45,\"C2\":\"Rogede sild\",\"C3\":21,\"C4\":8,\"C5\":\"1k pkg.\",\"C6\":9.5,\"C7\":5,\"C8\":70,\"C9\":15},{\"C1\":46,\"C2\":\"Spegesild\",\"C3\":21,\"C4\":8,\"C5\":\"4 - 450 g glasses\",\"C6\":12.0,\"C7\":95,\"C8\":0,\"C9\":0},{\"C1\":47,\"C2\":\"Zaanse koeken\",\"C3\":22,\"C4\":3,\"C5\":\"10 - 4 oz boxes\",\"C6\":9.5,\"C7\":36,\"C8\":0,\"C9\":0},{\"C1\":48,\"C2\":\"Chocolade\",\"C3\":22,\"C4\":3,\"C5\":\"10 pkgs.\",\"C6\":12.75,\"C7\":15,\"C8\":70,\"C9\":25},{\"C1\":49,\"C2\":\"Maxilaku\",\"C3\":23,\"C4\":3,\"C5\":\"24 - 50 g pkgs.\",\"C6\":20.0,\"C7\":10,\"C8\":60,\"C9\":15},{\"C1\":50,\"C2\":\"Valkoinen suklaa\",\"C3\":23,\"C4\":3,\"C5\":\"12 - 100 g bars\",\"C6\":16.25,\"C7\":65,\"C8\":0,\"C9\":30},{\"C1\":51,\"C2\":\"Manjimup Dried Apples\",\"C3\":24,\"C4\":7,\"C5\":\"50 - 300 g pkgs.\",\"C6\":53.0,\"C7\":20,\"C8\":0,\"C9\":10},{\"C1\":52,\"C2\":\"Filo Mix\",\"C3\":24,\"C4\":5,\"C5\":\"16 - 2 kg boxes\",\"C6\":7.0,\"C7\":38,\"C8\":0,\"C9\":25},{\"C1\":53,\"C2\":\"Perth Pasties\",\"C3\":24,\"C4\":6,\"C5\":\"48 pieces\",\"C6\":32.8,\"C7\":0,\"C8\":0,\"C9\":0},{\"C1\":54,\"C2\":\"Tourtiere\",\"C3\":25,\"C4\":6,\"C5\":\"16 pies\",\"C6\":7.45,\"C7\":21,\"C8\":0,\"C9\":10},{\"C1\":55,\"C2\":\"Pâté chinois\",\"C3\":25,\"C4\":6,\"C5\":\"24 boxes x 2 pies\",\"C6\":24.0,\"C7\":115,\"C8\":0,\"C9\":20},{\"C1\":56,\"C2\":\"Gnocchi di nonna Alice\",\"C3\":26,\"C4\":5,\"C5\":\"24 - 250 g pkgs.\",\"C6\":38.0,\"C7\":21,\"C8\":10,\"C9\":30},{\"C1\":57,\"C2\":\"Ravioli Angelo\",\"C3\":26,\"C4\":5,\"C5\":\"24 - 250 g pkgs.\",\"C6\":19.5,\"C7\":36,\"C8\":0,\"C9\":20},{\"C1\":58,\"C2\":\"Escargots de Bourgogne\",\"C3\":27,\"C4\":8,\"C5\":\"24 pieces\",\"C6\":13.25,\"C7\":62,\"C8\":0,\"C9\":20},{\"C1\":59,\"C2\":\"Raclette Courdavault\",\"C3\":28,\"C4\":4,\"C5\":\"5 kg pkg.\",\"C6\":55.0,\"C7\":79,\"C8\":0,\"C9\":0},{\"C1\":60,\"C2\":\"Camembert Pierrot\",\"C3\":28,\"C4\":4,\"C5\":\"15 - 300 g rounds\",\"C6\":34.0,\"C7\":19,\"C8\":0,\"C9\":0},{\"C1\":61,\"C2\":\"Sirop d'érable\",\"C3\":29,\"C4\":2,\"C5\":\"24 - 500 ml bottles\",\"C6\":28.5,\"C7\":113,\"C8\":0,\"C9\":25},{\"C1\":62,\"C2\":\"Tarte au sucre\",\"C3\":29,\"C4\":3,\"C5\":\"48 pies\",\"C6\":49.3,\"C7\":17,\"C8\":0,\"C9\":0},{\"C1\":63,\"C2\":\"Vegie-spread\",\"C3\":7,\"C4\":2,\"C5\":\"15 - 625 g jars\",\"C6\":43.9,\"C7\":24,\"C8\":0,\"C9\":5},{\"C1\":64,\"C2\":\"Wimmers gute Semmelknödel\",\"C3\":12,\"C4\":5,\"C5\":\"20 bags x 4 pieces\",\"C6\":33.25,\"C7\":22,\"C8\":80,\"C9\":30},{\"C1\":65,\"C2\":\"Louisiana Fiery Hot Pepper Sauce\",\"C3\":2,\"C4\":2,\"C5\":\"32 - 8 oz bottles\",\"C6\":21.05,\"C7\":76,\"C8\":0,\"C9\":0},{\"C1\":66,\"C2\":\"Louisiana Hot Spiced Okra\",\"C3\":2,\"C4\":2,\"C5\":\"24 - 8 oz jars\",\"C6\":17.0,\"C7\":4,\"C8\":100,\"C9\":20},{\"C1\":67,\"C2\":\"Laughing Lumberjack Lager\",\"C3\":16,\"C4\":1,\"C5\":\"24 - 12 oz bottles\",\"C6\":14.0,\"C7\":52,\"C8\":0,\"C9\":10},{\"C1\":68,\"C2\":\"Scottish Longbreads\",\"C3\":8,\"C4\":3,\"C5\":\"10 boxes x 8 pieces\",\"C6\":12.5,\"C7\":6,\"C8\":10,\"C9\":15},{\"C1\":69,\"C2\":\"Gudbrandsdalsost\",\"C3\":15,\"C4\":4,\"C5\":\"10 kg pkg.\",\"C6\":36.0,\"C7\":26,\"C8\":0,\"C9\":15},{\"C1\":70,\"C2\":\"Outback Lager\",\"C3\":7,\"C4\":1,\"C5\":\"24 - 355 ml bottles\",\"C6\":15.0,\"C7\":15,\"C8\":10,\"C9\":30},{\"C1\":71,\"C2\":\"Flotemysost\",\"C3\":15,\"C4\":4,\"C5\":\"10 - 500 g pkgs.\",\"C6\":21.5,\"C7\":26,\"C8\":0,\"C9\":0},{\"C1\":72,\"C2\":\"Mozzarella di Giovanni\",\"C3\":14,\"C4\":4,\"C5\":\"24 - 200 g pkgs.\",\"C6\":34.8,\"C7\":14,\"C8\":0,\"C9\":0},{\"C1\":73,\"C2\":\"Röd Kaviar\",\"C3\":17,\"C4\":8,\"C5\":\"24 - 150 g jars\",\"C6\":15.0,\"C7\":101,\"C8\":0,\"C9\":5},{\"C1\":74,\"C2\":\"Longlife Tofu\",\"C3\":4,\"C4\":7,\"C5\":\"5 kg pkg.\",\"C6\":10.0,\"C7\":4,\"C8\":20,\"C9\":5},{\"C1\":75,\"C2\":\"Rhönbräu Klosterbier\",\"C3\":12,\"C4\":1,\"C5\":\"24 - 0.5 l bottles\",\"C6\":7.75,\"C7\":125,\"C8\":0,\"C9\":25},{\"C1\":76,\"C2\":\"Lakkalikööri\",\"C3\":23,\"C4\":1,\"C5\":\"500 ml\",\"C6\":18.0,\"C7\":57,\"C8\":0,\"C9\":20},{\"C1\":77,\"C2\":\"Original Frankfurter grüne Soße\",\"C3\":12,\"C4\":2,\"C5\":\"12 boxes\",\"C6\":13.0,\"C7\":32,\"C8\":0,\"C9\":15}]";

            ICorrectness result = this.tester.TestQuery(
                context =>
                    context.Products.Where(p => p.ProductID < 5)
                    .Concat(
                    context.Products.Where(p => p.ProductID > 10)), 
                expected);

            Assert.IsTrue(result.Check());
        }
    }
}
